//
//  KTHallVC.m
//  KTLotteryTicket
//
//  Created by CoolKi on 16/3/4.
//  Copyright © 2016年 CoolKi. All rights reserved.
//

#import "KTHallVC.h"

#import "KTHActBagroundV.h"
#import "KTHActContentV.h"

@interface KTHallVC ()<KTHActContentVDelegate,KTHActBagroundVDelegate>
@property (nonatomic,weak)KTHActContentV * contentV;
@end

@implementation KTHallVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"CS50_activity_image"] style:0 target:self action:@selector(barButtonMeth)];
    
}
//导航条上的按钮
- (void)barButtonMeth{
    [KTHActBagroundV showWithDelegate:self];
    
    KTHActContentV * contentV = [KTHActContentV showAtPoint:CGPointMake(175,300)];
    self.contentV  = contentV;
    contentV.delegate = self;
}

#pragma mark - KTHActContentVDelegate
- (void)actContentView:(KTHActContentV *)contentV{
    [contentV hidenInPoint:CGPointMake(50, 50) Completion:^{

        //移除遮盖
        for (UIView *view in [UIApplication sharedApplication].keyWindow.subviews) {
            //判断当前View是否是遮盖
            if([view isKindOfClass:[KTHActBagroundV class]]) {
                [view removeFromSuperview];
            }
        }
    }];
}
#pragma mark - KTHActBagroundVDelegate
- (void)actBagroundV:(KTHActBagroundV *)actBagroundV{
    //手动调用 contentView的代理方法
    [self actContentView:self.contentV];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
